﻿/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page3={
    create:function () {
    var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        var bg=Easy.CreateSprite('assets/images/page_bg.png',0,0,0,0,1);
        page.ui.addChild(bg);

        var i0=Easy.CreateSprite('assets/images/p3_i0.png',0,0,0.0,0.0,0);
        page.ui.addChild(i0);

        var i1=Easy.CreateSprite('assets/images/p3_i1.png',326,265,0.5,0.5,0);
        page.ui.addChild(i1);
        var i2=Easy.CreateSprite('assets/images/p3_i2.png',306,483,0.5,0.5,0);
        page.ui.addChild(i2);
        var i3=Easy.CreateSprite('assets/images/p3_i3.png',326,598,0.5,0.5,0);
        page.ui.addChild(i3);
        var i4=Easy.CreateSprite('assets/images/p3_i4.png',348,378-10,0.5,0.5,0);
        page.ui.addChild(i4);

        var i5=Easy.CreateSprite('assets/images/p3_i5.png',300,390,0.5,0.5,0);
        page.ui.addChild(i5);
        var i6=Easy.CreateSprite('assets/images/p3_i6.png',405,384,0.5,0.5,0);
        page.ui.addChild(i6);
        var i7=Easy.CreateSprite('assets/images/p3_i7.png',640,556,0.5,0.5,0);
        page.ui.addChild(i7);

        var t0=Easy.CreateSprite('assets/images/p3_t0.png',201,772,0.5,0.5,0);
        page.ui.addChild(t0);
        var t1=Easy.CreateSprite('assets/images/p3_t1.png',315,854,0.5,0.5,0);
        page.ui.addChild(t1);
        var t2=Easy.CreateSprite('assets/images/p3_t2.png',361,1003,0.5,0.5,0);
        page.ui.addChild(t2);

        var tip=Easy.CreateSprite('assets/images/tip.png',370,1105,0.5,0.5,1);
        TweenMax.to(tip,1,{repeat:-1,yoyo:true,y:1105+30,alpha:0.7,ease:Cubic.easeInOut});
        page.ui.addChild(tip);

        var bt_locate=Easy.CreateSprite('assets/images/bt_locate.png',pixiStage.x+740,1020,1,0.5,1);
        bt_locate.interactive=true;
        page.ui.addChild(bt_locate);
        bt_locate.on('pointerdown',function()
        {
            showMap();
        });

        page.In=function () {
            i0.y=-745;
            i0.alpha=0;
            TweenMax.to(i0,1,{delay:0.4*0,y:0,alpha:1,ease:Cubic.easeInOut});

            t0.y=772+100;
            t0.alpha=0;
            TweenMax.to(t0,1,{delay:0.3*1,y:772,alpha:1,ease:Cubic.easeInOut});
            t1.y=854+100;
            t1.alpha=0;
            TweenMax.to(t1,1,{delay:0.3*2,y:854,alpha:1,ease:Cubic.easeInOut});
            t2.y=1003+100;
            t2.alpha=0;
            TweenMax.to(t2,1,{delay:0.3*3,y:1003,alpha:1,ease:Cubic.easeInOut});

            i1.alpha=0;
            i1.x=326-70;
            TweenMax.to(i1,1,{delay:0.3*4,alpha:1,x:326,ease:Back.easeOut,onComplete:function () {
                // TweenMax.to(i1,1,{x:326+20,repeat:-1,yoyo:true,ease:Cubic.easeInOut});
            }});
            i2.alpha=0;
            i2.x=306-70;
            TweenMax.to(i2,1,{delay:0.3*4,x:306,alpha:1,ease:Back.easeOut,onComplete:function () {
                // TweenMax.to(i2,1,{x:306+20,repeat:-1,yoyo:true,ease:Cubic.easeInOut});
            }});
            i3.alpha=0;
            i3.x=326-70;
            TweenMax.to(i3,1,{delay:0.3*4,x:326,alpha:1,ease:Back.easeOut,onComplete:function () {
                // TweenMax.to(i3,1,{x:326+20,repeat:-1,yoyo:true,ease:Cubic.easeInOut});
            }});
            i5.alpha=0;
            i5.x=300-50;
            TweenMax.to(i5,1,{delay:0.3*5,x:300,alpha:1,ease:Back.easeOut});
            i6.alpha=0;
            i6.x=405-50;
            TweenMax.to(i6,1,{delay:0.3*6,x:405,alpha:1,ease:Back.easeOut});
            i7.alpha=0;
            i7.x=640+50;
            TweenMax.to(i7,1,{delay:0.3*6,x:640,alpha:1,ease:Back.easeOut,onComplete:function () {
                TweenMax.to(i7,2,{repeat:-1,yoyo:true,y:556-15,ease:Cubic.easeInOut});
            }});

            i4.alpha=0;
            TweenMax.to(i4,0.7,{delay:0.3*6,alpha:1,ease:Cubic.easeOut});
            i4.scale.x=i4.scale.y=5;
            TweenMax.to(i4.scale,0.7,{delay:0.3*6,x:1,y:1,ease:Cubic.easeOut,onComplete:function () {
                TweenMax.to(i4.scale,1,{x:1.1,y:1.1,yoyo:true,repeat:-1,ease:Cubic.easeInOut});
            }});
        }
        page.Out=function()
        {
            TweenMax.killTweensOf(i0);
            TweenMax.killTweensOf(i1);
            TweenMax.killTweensOf(i2);
            TweenMax.killTweensOf(i3);
            TweenMax.killTweensOf(i4);
            TweenMax.killTweensOf(i5);
            TweenMax.killTweensOf(i6);
            TweenMax.killTweensOf(i7);
            TweenMax.killTweensOf(t0);
            TweenMax.killTweensOf(t1);
            TweenMax.killTweensOf(t2);

            TweenMax.to(page.ui,0.3,{alpha:1,onComplete:function () {
                page.ui.alpha=1;
                i0.alpha=0;
                i1.alpha=0;
                i2.alpha=0;
                i3.alpha=0;
                i4.alpha=0;
                i5.alpha=0;
                i6.alpha=0;
                i7.alpha=0;
                t0.alpha=0;
                t1.alpha=0;
                t2.alpha=0;
            }})
        }

    return page;
    }
}